home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / Fps.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  880 b   |  33 lines

  1. class Fps
  2. {
  3.    var mcContainer;
  4.    var tfDisplay;
  5.    var f;
  6.    var t;
  7.    function Fps()
  8.    {
  9.       this.mcContainer = _root.createEmptyMovieClip("mcContainer",9999);
  10.       this.tfDisplay = this.mcContainer.createTextField("tfDisplay",this.mcContainer.getNextHighestDepth(),0,0,22,22);
  11.       this.tfDisplay._x = Stage.width - this.tfDisplay._width;
  12.       this.tfDisplay.border = true;
  13.       this.tfDisplay.background = true;
  14.       this.tfDisplay.backgroundColor = 16777215;
  15.       this.f = 0;
  16.       this.t = getTimer();
  17.       this.mcContainer.onEnterFrame = mx.utils.Delegate.create(this,this.count);
  18.    }
  19.    function count(Void)
  20.    {
  21.       if(getTimer() - this.t > 1000)
  22.       {
  23.          this.tfDisplay.text = String(this.f);
  24.          this.t = getTimer();
  25.          this.f = 0;
  26.       }
  27.       else
  28.       {
  29.          this.f = this.f + 1;
  30.       }
  31.    }
  32. }
  33.